/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package robotlion.model;

import java.awt.Point;
import java.util.ArrayList;

/**
 *
 * @author test
 */
public class Environnement {


    
    private int VitesseMax = 200;
    private int vitesse;
    private int Temps;
    private EDirectionVent directionVent;

    
    public Environnement(int vitesse, EDirectionVent direction) {
        this.vitesse = vitesse;
        directionVent = EDirectionVent.SUD;
        if ( this.vitesse > VitesseMax )
        {
            this.vitesse = VitesseMax;
        }
        this.Temps = VitesseMax;
        this.directionVent = direction;
    }
    
    public ArrayList<Point> progression(ArrayList<Point> incendies)
    {
        ArrayList<Point> newIncendie = new ArrayList();
        if (Temps < vitesse)
        { 
            for(Point incendie : incendies)
            {
                switch(directionVent) {
                     case SUD :
                         newIncendie.add(new Point(incendie.x,incendie.y - 1));
                         break;
                     case EST :
                         newIncendie.add(new Point(incendie.x - 1 ,incendie.y));
                         break;
                     case OUEST :
                         newIncendie.add(new Point(incendie.x + 1,incendie.y));
                         break;
                     case NORD :                         
                         newIncendie.add(new Point(incendie.x,incendie.y+1));
                         break;
                     default:                    
                }
            }
            Temps = VitesseMax;
        }
        else
        {
            Temps -= 10;
        }
        return newIncendie;
    }
    
    public EDirectionVent getDirectionVent() {
        return directionVent;
    }

    public void setDirectionVent(EDirectionVent directionVent) {
        this.directionVent = directionVent;
    }

    public int getVitesse() {
        return vitesse;
    }

    public void setVitesse(int vitesse) {
        this.vitesse = vitesse;
    }
    
    
}
